package cn.coder.easyjson;

import java.util.HashMap;

import org.junit.Test;

/**
 * Unit test for simple App.
 */
public class AppTest2 {
	@Test
	public void testJson() {
		long s = System.currentTimeMillis();

		DataBean bean = new DataBean();
		bean.setGanmao("{\"sdf\":1}");
		bean.setWendu(11);
		HashMap<String, Object> map = new HashMap<>();
		map.put("sss\"sss", "al:ue");
		map.put("sdf", 456);
		bean.setData(map);
		String str = JSON.toJSON(bean);
		System.out.println(str);
		bean = JSON.parse(str, DataBean.class);
		System.out.println(bean.getGanmao());
//		System.out.println("desc=" + jsonObject.getString("desc"));
//		System.out.println("status=" + jsonObject.getInteger("status"));
//		JSONArray array = jsonObject.getJSONObject("data").getJSONArray("forecast");
//		array = jsonObject.getJSONObject("data").getJSONArray("forecast");
//		for (int i = 0; i < array.size(); i++) {
//			System.out.println(array.getJSONObject(i).getString("fengxiang"));
//		}
//
//		DataBean bean = JSON.parseObject(jsonObject.getJSONObject("data"), DataBean.class);
//		if(bean != null){
//			System.out.println(bean.getWendu());
//			System.out.println(bean.getGanmao());
//			System.out.println(bean.getForecast());
//		}
		
		System.out.println(System.currentTimeMillis() - s);
	}
}
